home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / CEGUISDK-0.4.1-VC6-Native.exe / {app} / Samples / common / include / CEGuiSample.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-08-19  |  3.6 KB  |  128 lines

  1. /************************************************************************
  2.     filename:   CEGuiSample.h
  3.     created:    24/9/2004
  4.     author:     Paul D Turner
  5. *************************************************************************/
  6. /*************************************************************************
  7.     Crazy Eddie's GUI System (http://www.cegui.org.uk)
  8.     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
  9.  
  10.     This library is free software; you can redistribute it and/or
  11.     modify it under the terms of the GNU Lesser General Public
  12.     License as published by the Free Software Foundation; either
  13.     version 2.1 of the License, or (at your option) any later version.
  14.  
  15.     This library is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.     Lesser General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU Lesser General Public
  21.     License along with this library; if not, write to the Free Software
  22.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23. *************************************************************************/
  24. #ifndef _CEGuiSample_h_
  25. #define _CEGuiSample_h_
  26.  
  27. #if defined( __WIN32__ ) || defined( _WIN32 )
  28. #   ifdef CEGUISAMPLE_EXPORTS
  29. #       define CEGUISAMPLE_API __declspec(dllexport)
  30. #   else
  31. #       define CEGUISAMPLE_API __declspec(dllimport)
  32. #   endif
  33. #else
  34. #       define CEGUISAMPLE_API
  35. #endif
  36.  
  37.  
  38. // forward declarations
  39. class CEGuiBaseApplication;
  40. class CEGuiRendererSelector;
  41.  
  42.  
  43. /*!
  44. \brief
  45.     This is a base class that is intended to be used for all sample applications.
  46.     Here we take care of common things such the renderer selection and application
  47.     startup.
  48. */
  49. class CEGUISAMPLE_API CEGuiSample
  50. {
  51. public:
  52.     /*!
  53.     \brief
  54.         Constructor.
  55.     */
  56.     CEGuiSample();
  57.  
  58.  
  59.     /*!
  60.     \brief
  61.         Destructor.
  62.     */
  63.     virtual ~CEGuiSample();
  64.  
  65.  
  66.     /*!
  67.     \brief
  68.         Application entry point.
  69.  
  70.     \return
  71.         code to be returned by the application.
  72.     */
  73.     int run();
  74.  
  75.  
  76.     /*!
  77.     \brief
  78.         Sample specific initialisation goes here.  This method is called by the application base object created
  79.         as part of the initialise call.
  80.  
  81.     \return
  82.         false if something went wrong.
  83.     */
  84.     virtual bool initialiseSample()  = 0;
  85.  
  86.  
  87.     /*!
  88.     \brief
  89.         Cleans up resources allocated in the initialiseSample call.
  90.     */
  91.     virtual void cleanupSample() = 0;
  92.  
  93.  
  94. protected:
  95.     /*!
  96.     \brief
  97.         Initialises the sample system, this includes asking the user for a render to use and
  98.         the subsequent creation of the required systems to support that renderer.
  99.  
  100.     \return
  101.         false if anything went wrong.
  102.     */
  103.     virtual bool initialise();
  104.  
  105.  
  106.     /*!
  107.     \brief
  108.         Cleans up all resources allocated by the initialise call.
  109.     */
  110.     virtual void cleanup();
  111.  
  112.  
  113.     /*!
  114.     \brief
  115.         Output a message to the user in some OS independant way.
  116.     */
  117.     void outputExceptionMessage(const char* message) const;
  118.  
  119.  
  120.     /*************************************************************************
  121.         Data fields
  122.     *************************************************************************/
  123.     CEGuiRendererSelector*  d_rendererSelector;     //!< Points to the renderer selector object.
  124.     CEGuiBaseApplication*   d_sampleApp;            //!< Pointer to the base application object.
  125. };
  126.  
  127. #endif  // end of guard _CEGuiSample_h_
  128.